package org.easy.milvus;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;
import org.easy.core.util.HttpUtil;

import java.util.List;

public class FileChunkClient {
    public FileChunkClient(String url) {
        this.url = url;
    }

    /**
     * 127.0.0.1:8002/load_and_split
     */
    private String url;


    /**
     * 文本切块
     *
     * @param originFileUrl
     * @return
     */
    public List<String> chunkFile(String originFileUrl) {

        String str = "{\"file_url\": \"" + originFileUrl + "\"}";

        String jsonArrayStr = HttpUtil.postJson(url, null, str);
        return JSON.parseObject(jsonArrayStr, new TypeReference<List<String>>() {
        });
    }

}
